import time
import unittest
from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.firefox.service import Service


class UnittestFireFoxDriver(unittest.TestCase):
    """
        driver 代表的是 浏览器 驱动对象
    """
    driver = None

    @classmethod
    def setUpClass(cls) -> None:
        cls.service = Service(executable_path='../day01/driver_exe/geckodriver.exe')
        cls.driver = webdriver.Firefox(service=cls.service)

    def test_element_double_click(self):
        """双击操作"""
        self.driver.get('file:///D:/SoftWare/testhtml/exam/House.html')
        # 2.1、 通过 css 的方式来进行 元素 定位
        wymc = self.driver.find_element(By.CLASS_NAME, "uname")
        ActionChains(self.driver).double_click(wymc).perform()

    @classmethod
    def tearDownClass(cls) -> None:
        # cls.driver.close()
        # cls.driver.quit()
        pass


if __name__ == '__main__':
    pass
